import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import '../style/theme.dart';

class RowWrap extends StatelessWidget {
  final Widget? label;
  final Widget content;
  final MainAxisAlignment? mainAxisAlignment;

  const RowWrap(
      {super.key, this.label, required this.content, this.mainAxisAlignment});

  @override
  Widget build(BuildContext context) {
    final List<Widget> children = [];

    if (label != null) {
      children.add(label!);
    }
    children.add(content);

    return Container(
      padding: const EdgeInsets.all(8),
      child: Row(
        mainAxisAlignment: mainAxisAlignment ?? MainAxisAlignment.spaceBetween,
        children: children,
      ),
    );
  }
}

class RowControl extends RowWrap {
  RowControl(
      {super.key,
      String? label,
      required super.content,
      super.mainAxisAlignment})
      : super(
            label: label != null
                ? SelectableText(
                    label,
                    style: const TextStyle(
                      fontSize: 16,
                    ),
                  )
                : null);
}

class RowInfo extends RowControl {
  RowInfo(
      {super.key,
      super.label,
      required String content,
      super.mainAxisAlignment})
      : super(
            content: SelectableText(
          content,
          style: const TextStyle(fontSize: 16, color: themeColorTextSecondary),
        ));
}
